/**
 * Created by A on 2017/12/25.
 */

var use={
    // 设置滑动效果
    setSlide:function(status,title,length,parent,parentIndex){
        // title需要解析的标题文字，length当长度大于多少时就变成划定，小于就不显示滑动
        // parent  文字的父元素  ，parentIndex  父元素的class索引值
        if(status=='slide'){
            if(title.length>length){
                document.getElementsByClassName(parent)[parentIndex].innerHTML='<marquee scrollamount="4">'+ title+'</marquee>';
            }else{
                document.getElementsByClassName(parent)[parentIndex].innerHTML=title;
            }
        }else{
            if(title.length>length){
                document.getElementsByClassName(parent)[parentIndex].innerHTML=title.substring(0,length)+'...';
            }else{
                document.getElementsByClassName(parent)[parentIndex].innerHTML=title;
            }
        }
    },
    //截取传值参数
    GetQueryString:function(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)","i");
        var r = window.location.search.substr(1).match(reg);
        if (r!=null) return (r[2]); return null;
    }
};